@extends('frontend/layouts/flaty_to_bootstrap')

@section('content.titley')
ReAuction Management ::
@parent
@stop

@section('content.breadcrumb.inner')
    <li><a href="{{  route('home') }}"><i class="icon-home"></i> Dashboard</a><span class="divider"><i class="icon-angle-right"></i></span></li>
    <li class="active">ReAuction list</li>
@stop

@section('content.main')

<!--<p>{{ link_to_route('car_balance.re_auction.create', 'Add new ReAuction', null, array('class' => 'btn btn-info')) }}</p>-->


{{  $re_auctions->links() }}

<table class="table table-bordered table-striped table-hover">
    <thead>
    <tr>
        <th title="Car Detial">Car Detial</th>
        <th title="Re Auction Date">Re Auction Date</th>
        <th title="Service Company">Service Company</th>
        <th title="Transport Company">Transport Company</th>
        <th title="Auction name">Auction name</th>
        <th title="Sold Price">Sold Price</th>
        <th title="Sold Vat">Sold Vat</th>
        <th title="Recycle">Recycle</th>
        <th title="Car Tax">Car Tax</th>
        <th title="Transport fee">Transport fee</th>
        <th title="Re Auction Fee">Re Auction Fee</th>
        <th title="Success Fee">Success Fee</th>
        <th title="Total">Total</th>
        <th title="Status">Status</th>
        <th class="span2">Actions</th>
    </tr>
    </thead>
    <tbody>
    @foreach ($re_auctions as $re_auction)
    <tr>
<!--        <td>{{  link_to_route('car_balance.re_auction.show', $re_auction->id, array($re_auction->id), array()) }}</td>-->
        <td><a href="{{ route('car_balance.car.car_show', $re_auction->purchase_car_id) }}" title="Car">{{ $re_auction->purchase_car->auction_name }} - {{ $re_auction->purchase_car->lot_no }} - {{ $re_auction->purchase_car->car_maker }} - {{ $re_auction->purchase_car->car_name }} - {{ $re_auction->purchase_car->chasis_no }}</a></td>
        <td>{{  $re_auction->re_auction_date }}</td>
        <td>{{  $re_auction->serviceCompany()->first() ? link_to_route('car_balance.service_company.show', $re_auction->serviceCompany()->first()->name, array('id' => $re_auction->serviceCompany()->first()->id), array()) : 'NULL' }}</td>
        <td>{{  $re_auction->transportCompany()->first() ? link_to_route('car_balance.transport_company.show', $re_auction->transportCompany()->first()->name, array('id' => $re_auction->transportCompany()->first()->id), array()) : 'NULL' }}</td>
        <td>{{ $re_auction->auction_name }}</td>
        <td>{{  $re_auction->re_auction_sold_price }}</td>
        <td>{{ number_format(($re_auction->re_auction_sold_price*$re_auction->re_auction_sold_vat)/100, 0); }}</td>
        <td>{{  $re_auction->re_auction_recycle_amount }}</td>
        <td>{{  $re_auction->re_auction_car_tax_amount }}</td>
        <td>{{  $re_auction->re_auction_transport_fee }}</td>
        <td>{{  $re_auction->re_auction_fee }}</td>
        <td>{{  $re_auction->re_auction_success_fee }}</td>
        <td>{{  $re_auction->re_auction_total }}</td>
        <td>{{ $re_auction->status == '0' ? 'Зарагдаагүй' : 'Зарагдсан' }}</td>
        <td>
            <a href="{{  route('car_balance.re_auction.edit', $re_auction->id) }}" class="btn btn-mini">Edit</a>
            <a href="{{  route('car_balance.re_auction.delete', $re_auction->id) }}" class="btn btn-mini btn-danger">Delete</a>
        </td>
    </tr>
    @endforeach
    </tbody>
</table>

{{  $re_auctions->links() }}

@stop